package com.qf.dao;

import com.qf.pojo.entity.TbAdminRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface TbAdminRoleRepository extends JpaRepository<TbAdminRole,Integer> {
    @Modifying
    @Transactional
    @Query(value = "delete from tb_admin_role where ad_id = ?1",nativeQuery = true)
    void deleteByIdByAdminId(Integer adId);
    @Query(value = "SELECT ro_id FROM tb_admin_role WHERE ad_id = ?1",nativeQuery = true)
    List<Integer> findRoleIdByAdId(Integer adId);
}
